<template>
	<view class="contents">
		<navbar title='商学院详情'>
		</navbar>
		<view class="content">
			<view class="xqone">
				<text class="name">{{ info.title }}</text>
				<view class="ren">
					<image class="rentou" :src="info.author_avatar" />
					<text class="xming">{{info.author}}</text>
				</view>
				<text class="times">{{ info.createtime }}</text>
			</view>
			<view class="heng"></view>
			<view class="nei">
				<u-parse :html="info.content" :tag-style="style"></u-parse>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				style: {
						img: 'width:max-width:100%;height:auto;pointer-events: none;',
						video:'width:max-width:100%;width:100%;'
				},
				content:'内容',
				id:'',
				info:{}
			}
		},
		onLoad(option) {
			if(option.id){
				this.id = option.id
			}
			if(option.invite_code){
				this.invite_code = option.invite_code
				uni.setStorageSync('invite_code',this.invite_code);
				this.$store.commit('changeinvite_code',this.invite_code);
			}
			this.getDetail()
		},
		onShow() {
		},
		onShareAppMessage(res) {
			if (res.from === 'button') { // 来自页面内分享按钮
				console.log(res.target);
			}
			 const param1 = this.$store.state.code||uni.getStorageSync('code');
    		const param2 = this.id;
			return {
				title: this.info.title,
				imageUrl:this.info.image,
				path: `/pages_client/mine/BusinessDetail?invite_code=${param1}&id=${param2}`,
				// path: '/pages_client/mine/BusinessDetail?invite_code='+this.$store.state.code||uni.getStorageSync('code')+'&id='+this.id
			}
		},
		onShareTimeline(){
			const param1 = this.$store.state.code||uni.getStorageSync('code');
    		const param2 = this.id;
			return {
				title: this.info.title,
				imageUrl:this.info.image,
				path: `/pages_client/mine/BusinessDetail?invite_code=${param1}&id=${param2}`,
			}
		},
		methods: {
			async getDetail(){
				let res = await this.$u.api.shangdetail({
					id:this.id
				});
				this.info = res
			}
		}
	}
</script>

<style lang="scss" scoped>
	page{
		background-color: #fff;
	}
	.content{
		background-color: #fff;
		.xqone{
			padding: 30rpx;
			display: flex;
			flex-direction: column;
			.name{
				font-weight: bold;
				font-size: 32rpx;
				color: #333333;
			}
			.ren{
				display: flex;
				flex-direction: row;
				align-items: center;
				margin: 20rpx 0;
				.rentou{
					width: 70rpx;
					height: 70rpx;
					border-radius: 50%;
					margin-right: 20rpx;
				}
				.xming{
					font-weight: 500;
					font-size: 24rpx;
					color: #666666;
				}
			}
			.times{
				display: block;
				margin-top: 40rpx;
				font-weight: 500;
				font-size: 28rpx;
				color: #666666;
			}
		}
		.heng{
			height: 10rpx;
			width: 100%;
			background-color: #eee;
			margin: 30rpx 0;
		}
	}
	.nei{
		padding: 0 30rpx;
	}
</style>
